public class Solution1800 {
    public int maxAscendingSum(int[] nums) {
        int max=0,now;
        for (int i=0;i<nums.length;i++){
            now=nums[i];
            while (i+1<nums.length && nums[i]<nums[i+1]){
                i++;
                now+=nums[i];
            }
            max=Math.max(max,now);
        }
        return max;
    }

    public static void main(String[] args) {
        System.out.println(new Solution1800().maxAscendingSum(new int[]{10,20,30,5,10,50}));
    }
}
